package rmmk.algorithms.knn;

import java.util.List;

import rmmk.algorithms.features.FeatureManager;
import rmmk.algorithms.preprocessing.config.DistanceMetric;
import rmmk.algorithms.similarityMeasures.SimilarityMeasureManager;
import rmmk.framework.datasources.Document;

/**
 * Fasada dla algorytmu knn
 * @author marcin
 *
 */
public class KnnOwnImpl extends AbstractKnnClassifier {

	KnnAlgorithm knn;
	FeatureManager fm;
	SimilarityMeasureManager smm;
	
	@Override
	public void teach(List<Document> documents, FeatureManager fm, SimilarityMeasureManager smm) {
		knn = new KnnAlgorithm(documents, fm,smm,getType());
		this.fm = fm;
		this.smm = smm;
	}

	@Override
	public Document predict(Document document, DistanceMetric dm) {
		return knn.calculate(document, fm, smm, getK(), dm,getType());
	}
}
